home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / jovept2.arc / STRNCPY.C < prev    next >
Text File  |  1985-05-30  |  512b  |  24 lines

  1. /* strncpy.c */
  2.  
  3. /* JOVE/MSDOS. K. Mitchum 1/85 */
  4. /* Ken Mitchum */
  5. /* University of Pittsburgh */
  6. /* Decision Systems Laboratory */
  7.  
  8. /* altered version for jove */
  9.  
  10. /*    copy a string into a buffer n characters in length
  11. */
  12.  
  13. unsigned char *strncpy(to,from,n)
  14. unsigned char *to,*from;
  15. unsigned n;
  16. {
  17.   unsigned char *cp;
  18.  
  19.   for(cp=to;n && (*cp=*from++);n--,cp++);
  20.   while(n--)*cp++=0;
  21.   return to;
  22. }
  23.  
  24.